﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace MsForgeReboot.Framework.TownCrierChannels {
    public class BaseChannelSection : ConfigurationSection {
        private static ConfigurationProperty _oauth_token;
        private static ConfigurationProperty _baseurl;
        private static ConfigurationProperty _postresource;


        [ConfigurationProperty("oAuthTokens", IsRequired = true)]
        public OAuthTokenConfigurationElement OauthToken {
            get { return (OAuthTokenConfigurationElement)base[_oauth_token]; }
            set { base[_oauth_token] = value; }
        }

        [ConfigurationProperty("apiBaseUrl", IsRequired = true)]
        public BaseUrlConfigurationElement ApiBaseUrl {
            get { return (BaseUrlConfigurationElement)base[_baseurl]; }
        }

        [ConfigurationProperty("apiPostResource", IsRequired = true)]
        public PostResourceConfigurationElement ApiPostResource  {
            get { return (PostResourceConfigurationElement)base[_postresource]; }
        }


        private static ConfigurationPropertyCollection _collection;

        static BaseChannelSection() {
            _oauth_token = new ConfigurationProperty(
                "oAuthTokens",
                typeof(OAuthTokenConfigurationElement),
                null,
                ConfigurationPropertyOptions.IsRequired
                );
            _baseurl = new ConfigurationProperty(
                "apiBaseUrl",
                typeof(BaseUrlConfigurationElement),
                null,
                ConfigurationPropertyOptions.IsRequired
                );
            _postresource = new ConfigurationProperty(
                "apiPostResource",
                typeof(PostResourceConfigurationElement),
                null,
                ConfigurationPropertyOptions.IsRequired
                );

            _collection = new ConfigurationPropertyCollection{
                _oauth_token,_baseurl,_postresource
            };
        }


        protected override ConfigurationPropertyCollection Properties {
            get {
                return _collection;
            }
        }
    }
}
